<html>
	<?
	include 'web/header.phtml';
	?>
<style>
	.AccountTable table {
		font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
		font-size: 12px;
		width: 700px;
		text-align: left;
		border-collapse: collapse;
		margin: 20px;
	}
	.AccountTable thead {
		display: table-header-group;
		vertical-align: middle;
		border-color: inherit;
	}
	.AccountTable th {
		font-size: 13px;
		font-weight: normal;
		background: #B9C9FE;
		border-bottom: 1px solid white;
		color: #039;
		padding: 8px;
	}
	.AccountTable td {
		background: #E8EDFF;
		border-bottom: 1px solid white;
		color: #669;
		border-top: 1px solid transparent;
		padding: 8px;
	}
	.AccountTable tr:hover td {
		background: #D0DAFD;
		color: #339;
	}
	</style>
	<script type="text/javascript">
		function selectAccount(Account) {			
			$.getJSON('admin.php', {
			view : "account",
			do : "select",
			Account : "Diep"
			}, function(data) {				
				$("#Account").val(data.Account);
				$("#Password").val(data.Password);
				$("#Name").val(data.Name);
				$("#Email").val(data.Email);
				$("#Birthday").val(data.Birthday);
				$("#Role").val(data.Role);
				$("#Address").val(data.Address);
				$("#Phone").val(data.Phone);
				$("#About").val(data.About);

			});

		}

		
		function deleteAccount(Account) {
			if (confirm('Are you sure want to delete Account ' + Account + '?')) {
				$.ajax({
				type : "POST",
				url : "admin.php?view=Account",
				data: { do: "delete", Account: Account }, success : function(html) {
					alert(html);
				}
			});
			}
			else
			alert('Undeleted')
		}
	</script>

	<body>

		<?
		include 'web/body.header.phtml';
		include 'web/body.menu.phtml';
		?>

		<div id="page">

			<?
			include 'web/body.banner.phtml';
			?>
			<?
			include 'view/listCategory.php';
			?>
			<div id="content">
				<div class="box" id="box3">
					<h2 class="title1"><?=$MSS ?></h2>
					<div class="entry">

						<div style="clear: both; margin-bottom: 20px;"></div>
						<div class="AccountTable">	
							<?echo $PageLink?>		
						<!-- start content -- -->						
						<table>
							
							<?php
							if (count($Accounts) > 0) {
								echo "<thead>
								<tr>
									<th>Account</th><th>Password</th><th>Name</th><th>Email</th><th>Birthday</th><th>Role</th><th>Address</th><th>Phone</th><th>About</th>
								</tr>
							</thead>";
								foreach ($Accounts as $Account) {
									echo "<tr>
<td>$Account[Account]</td>
<td>$Account[Name]</td>
<td>$Account[Email]</td>
<td>$Account[Birthday]</td>
<td>$Account[Role]</td>
<td>$Account[Address]</td>
<td>$Account[Phone]</td>
<td>$Account[About]</td>
<td><input type='button'value='Select' onclick=selectAccount('".$Account[Account]."') style='width:60px'/>
<button onclick=deleteAccount($Account[Account])>Delete</button></td>
</tr>";
								}
							}
							?>
						</table>

						<form name="addAccount" action="admin.php?view=account" method="post"  enctype="multipart/form-data" onsubmit="return ValidateForm();">
							<input type="hidden" name="view" value="Account" />
							<table>
								<tr>
									<td>Account:</td><td>
									<input type="text" name="Account" id="Account" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>Password:</td><td>
									<input type="text" name="Password" id="Password" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>Name:</td><td>
									<input type="text" name="Name" id="Name" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>Email:</td><td>
									<input type="text" name="Email" id="Email" size=50 maxlength=200>
									</td>
								</tr>

								<tr>
									<td>Birthday:</td>
									<td>
									<input type="text" name="Birthday" id="Birthday" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>Role:</td>
									<td>
									<input type="text" name="Role" id="Role" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>Address:</td>
									<td><textarea id="Address" name="Address" cols="50" rows="5" style="width:335px"></textarea></td>
								</tr>
																<tr>
									<td>Phone:</td>
									<td>
									<input type="text" name="Phone" id="Phone" size=50 maxlength=200>
									</td>
								</tr>
								<tr>
									<td>About:</td>
									<td><textarea id="About" name="About" cols="50" rows="5" style="width:335px"></textarea></td>
								</tr>
								<tr>
									<td>Active</td>
									<td>
									<input type="checkbox" name="Active" value="1" />
									</td>
								</tr>
								<tr>
									<td colspan="2" align="right">
									<input type="submit" value="Add" name="Submit"/>
									<input type="submit" value="Modify" name="Submit"/>
									<input type="reset" value="Reset" name="Clear">
									</td>

								</tr>
							</table>

						</form>
</div>
						<!-- end content -- -->
					</div>
				</div>

			</div>

		</div>

		<?
		include 'web/body.wrapper.phtml';
		?>
	</body>
</html>

